Skip to content

fix(config): strip defaults#9

Merged
fbosch merged 2 commits into
masterfrom
fix/config-generation
Jan 31, 2026
Merged

fix(config): strip defaults#9
fbosch merged 2 commits into
masterfrom
fix/config-generation

Conversation

@fbosch
Copy link
Copy Markdown
Owner

@fbosch fbosch commented Jan 31, 2026

Summary

Remove default values when writing config to keep files lean.

Changes

  • Add stripDefaultConfigValues() function to remove config properties matching defaults
  • Apply stripping in add, init, and remove commands when writing package.json
  • Add fallback package.json resolution path in loadToolVersion()
  • Add tests for package.json config output and tool version detection

Copilot AI review requested due to automatic review settings January 31, 2026 21:41
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Jan 31, 2026

Open in StackBlitz

npx https://pkg.pr.new/fbosch/docs-cache@9

commit: 51f9942

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request adds functionality to strip default configuration values when writing to package.json, helping keep configuration files lean. The main change is the introduction of a stripDefaultConfigValues() function that removes properties matching default values, along with its application in the add, init, and remove commands when writing package.json configs. The PR also adds a fallback path for loading the tool version from package.json and includes tests for both the stripping behavior and tool version detection.

Changes:

  • Added stripDefaultConfigValues() function to remove config properties that match default values
  • Applied stripping in add, init, and remove commands when writing package.json (not standalone config files)
  • Added fallback package.json resolution path (../../package.json) in loadToolVersion() for bundled code
  • Added tests verifying package.json configs omit default fields and tool version detection works

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/config.ts Adds stripDefaultConfigValues() function and isEqualStringArray() helper to remove default values from config
src/add.ts Applies stripDefaultConfigValues() when writing package.json configs
src/init.ts Applies stripDefaultConfigValues() when writing package.json configs
src/remove.ts Applies stripDefaultConfigValues() when writing package.json configs
src/sync.ts Adds fallback to ../../package.json for finding tool version in bundled builds
tests/cli-add.test.js Adds test verifying package.json configs don't include default fields
tests/sync-tool-version.test.js Adds test verifying lock file contains correct tool version from package.json

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/config.ts
Comment thread tests/cli-add.test.js
@fbosch fbosch merged commit b1753d2 into master Jan 31, 2026
5 checks passed
@fbosch fbosch deleted the fix/config-generation branch January 31, 2026 21:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants